package com.zyl.demo.service;

import com.zyl.demo.beans.Category;
import com.zyl.demo.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryService {
    @Autowired
    CategoryMapper categoryMapper;

    public List<Category> getAllCategory() {
        return categoryMapper.getAllCategory();
    }

    public int addCategory(Category category) {
        return categoryMapper.addCategory(category);
    }

    public int deleteCategory(int categoryId) {
        return categoryMapper.deleteCategory(categoryId);
    }

    //获得前三
    public List<Category> getCategoryTopThree() {
        return categoryMapper.getCategoryTopThree();
    }


}
